﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DatabaseUserTest.Model;

namespace DatabaseUserTest.Controller
{
    public class DijkstraCTRL
    {
        private Dijkstra dijkstra = new Dijkstra();
        private NodeAdd add = new NodeAdd();
        

        public CompleteRoute CalculateShortestPath(string from, string to, int check, DateTime date, int seats, bool firstClass)
        {
            Graph graph = add.AddNode(check, date, seats, firstClass);
            GraphNode start = graph.FindNode(from);
            GraphNode end = graph.FindNode(to);

            if (start != null && end != null)
            {
                return dijkstra.FindShortestPath(start, end, graph);
            }
            else
            {
                return null;
            }
        }
    }
}
